@using WalkingTec.Mvvm.Mvc;
@model WalkingTec.Mvvm.Mvc.Admin.ViewModels.FrameworkMenuVMs.FrameworkMenuVM
@using Microsoft.Extensions.Localization;
@inject IStringLocalizer<Program> Localizer;

<wt:form vm="@Model">
    <wt:row items-per-row=" ItemsPerRowEnum.Two">
        <wt:radio field="Entity.IsInside" yes-text="@Localizer["_Admin.Inside"]" no-text="@Localizer["_Admin.Outside"]" change-func="MenuTypeChange(data)" />
    </wt:row>
    <wt:row id="modelrow">
        <wt:combobox field="SelectedModule" items="AllModules" link-field="SelectedActionIDs"
                     trigger-url="/_Admin/FrameworkMenu/GetActionsByModelId" enable-search="true" change-func="ModelChange(data)" />
        <wt:checkbox field="SelectedActionIDs" items="AllActions" />
    </wt:row>
    <wt:row id="urlrow">
        <wt:textbox field="Entity.Url" />
    </wt:row>
    <wt:row items-per-row="ItemsPerRowEnum.Two">
        <wt:textbox field="Entity.PageName" />
        <wt:combobox field="Entity.ParentId" items="AllParents" />
    </wt:row>
    <wt:row items-per-row="ItemsPerRowEnum.Two">
        <wt:textbox field="Entity.DisplayOrder" />
   <wt:combobox field="Entity.TenantAllowed" />
   </wt:row>
    <wt:row items-per-row="ItemsPerRowEnum.Two">
        <wt:combobox field="IconFont" items="@IconFontsHelper.IconFontItems" enable-search="true" link-field="IconFontItem" trigger-url="/_Admin/FrameworkMenu/GetIconFontItems" />
        <wt:combobox field="IconFontItem" items="IconSelectItems" enable-search="true" />
    </wt:row>
    <wt:row items-per-row="ItemsPerRowEnum.Four">
        <wt:switch field="Entity.ShowOnMenu" lay-text="@Localizer["Sys.Yes"]|@Localizer["Sys.No"]" />
        <wt:switch field="Entity.FolderOnly" lay-text="@Localizer["Sys.Yes"]|@Localizer["Sys.No"]" />
        <wt:switch field="Entity.IsPublic" lay-text="@Localizer["Sys.Yes"]|@Localizer["Sys.No"]" />
    </wt:row>
    <wt:hidden field="SelectedRolesIds" />
    <wt:hidden field="Entity.ID" />
    <wt:row align="AlignEnum.Right">
        <wt:submitbutton />
        <wt:closebutton />
    </wt:row>
</wt:form>

<script>
    DoMenuTypeChange('@Model.Entity.IsInside.ToString().ToLower()');
    function MenuTypeChange(data) {
      DoMenuTypeChange(data.value);
    }
    function DoMenuTypeChange(inside) {
      var url = $('#urlrow');
      var model = $('#modelrow');
      if (inside == "true") {
        url.css('display', 'none');
        model.css('display', 'block');
      }
      else {
        url.css('display', 'block');
        model.css('display', 'none');

      }
    }
    function ModelChange(data) {
      var st = "";
      if(data.arr.length>0){
        st = data.arr[0].name;
      }
      $('#FrameworkMenuVM_Entity_PageName').val(st);
    }

</script>

<!-- WTM默认页面 Wtm buidin page-->
